#include <iostream>

using namespace std;

template <class T> T Average(T a[], int n) {
    T sum = 0;
    for (int i = 0; i < n; ++i)
        sum += *a++;
    return sum / n;
}

int main() {
    int a[] = {1, 2};
    cout << Average(a, 2) << endl;
    return 0;
}
